package com.kintreda.ieco_server.module.autoreply.service.impl;

import com.kintreda.ieco_server.bean.system.KeyWord;
import com.kintreda.ieco_server.core.service.impl.BaseServiceImpl;
import com.kintreda.ieco_server.module.autoreply.service.IKeyWordService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Created by IntelliJ IDEA
 * @Project_Name ieco_server
 * @Package com.kintreda.ieco_server.module.autoreply.service
 * @Author ZhongYao_H
 * @Date 2019/5/21:19:19
 * @Year 2019 Month 05 Day 21
 * @Date_zh 2019 年 五月 星期二
 */
@Service
public class KeyWordServiceImpl extends BaseServiceImpl<KeyWord,String> implements IKeyWordService {
    @Override
    public Boolean isadd(String keyword) {
        List<KeyWord> query = query("from KeyWord where keyword = ? ", new Object[]{keyword});
        return query.size()>0;
    }

    @Override
    public List<KeyWord> getKeyWordByKey(String keyword) {
        return  query("from KeyWord where keyword like ? ", new Object[]{"%"+keyword+"%"});

    }

    @Override
    public List<KeyWord> getListByType(String type,String typeC) {
        return  query("from KeyWord where typeA = ? and typeC = ?", new Object[]{type,typeC});
    }

    @Override
    public List<KeyWord> getListByTypeA(String type) {
        return  query("from KeyWord where typeA = ? ", new Object[]{type});
    }

    @Override
    public List<KeyWord> getListByTypeB(String type) {
        return  query("from KeyWord where typeB = ? ", new Object[]{type});
    }
}
